package  com.cnn.base.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cnn.base.util.JsonUtil;
import  com.cnn.base.model.ReRoleResource;
import  com.cnn.base.service.ReRoleResourceService;

@RestController
@RequestMapping("/reRoleResource")
public class ReRoleResourceController {

	@Resource
	private ReRoleResourceService reRoleResourceService;

	@RequestMapping("/getReRoleResource")
	public String getReRoleResource() {
		return JsonUtil.success(reRoleResourceService.getReRoleResource());
	}

	@RequestMapping("/getReRoleResourceById")
	public String getReRoleResourceById(String id) {
		return JsonUtil.success(reRoleResourceService.getReRoleResourceById(Long.valueOf(id)));
	}

	@RequestMapping("/addReRoleResource")
	public String addReRoleResource(ReRoleResource reRoleResource) {
		reRoleResourceService.addReRoleResource(reRoleResource);
		return JsonUtil.success();
	}

	@RequestMapping("/updateReRoleResource")
	public String updateReRoleResource(ReRoleResource reRoleResource) {
		reRoleResourceService.updateReRoleResource(reRoleResource);
		return JsonUtil.success();
	}

	@RequestMapping("/deleteReRoleResource")
	public String deleteReRoleResource(String id) {
		reRoleResourceService.deleteReRoleResource(Long.valueOf(id));
		return JsonUtil.success();
	}
}
